import java.util.Scanner;
import java.util.*;

public class MC0404寻找出口 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        // code here
        String next = input.nextLine();
        int x = 0, y = 0;
        for (int i = 0; i < next.length(); i++) {
            char str = next.charAt(i);
            if (str == 'L') {
                x -= 1;
            } else if (str == 'D') {
                y -= 1;
            } else if (str == 'R') {
                x += 1;
            } else {
                y += 1;
            }
        }
        System.out.println(x + " " + y);
        input.close();
    }
}
